from django.db import models

# Create your models here.
class Idc(models.Model):
	name = models.CharField(max_length=12)
        address = models.CharField(max_length=64, null=True, blank=True)
	remark = models.CharField(max_length=255, null=True, blank=True)

	def __unicode__(self):
		return self.name

class Cabinet(models.Model):
	idc = models.ForeignKey(Idc, on_delete=models.PROTECT)
	name = models.CharField(max_length=20)

	def __unicode__(self):
		return self.name

class Server(models.Model):
	cabinet = models.ForeignKey(Cabinet, null=True, blank=True, on_delete=models.PROTECT)
	sn = models.CharField(max_length=20, null=True, blank=True)
	cpu = models.CharField(max_length=64, null=True, blank=True)
	memory = models.CharField(max_length=64, null=True, blank=True)
	disk = models.CharField(max_length=64, null=True, blank=True)
	brand = models.CharField(max_length=10, null=True, blank=True)
	model = models.CharField(max_length=20, null=True, blank=True)
	
	def __unicode__(self):
		return self.id
	
	
	
class Device(models.Model):
	id = models.CharField(max_length=32, primary_key=True)
	
